-
Notifications
You must be signed in to change notification settings - Fork 560
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support my method
and ->&meth
syntax
#22940
base: blead
Are you sure you want to change the base?
Conversation
pod/perlclass.pod
Outdated
@@ -185,6 +185,26 @@ Just like regular subroutines, methods I<can> be anonymous: | |||
} | |||
} | |||
|
|||
Methods can also be declared as lexical subroutines, using the C<my> prefix. | |||
This creates a subroutine that is lexically visible within the current scope, | |||
but does not appear in the symbol table. This creates the effect of a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: You have two sentences in a row which start with "This creates...." I suggest rephrasing one of them.
P.S. This is a great addition. Thanks, @leonerd.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahyes; given it a slight edit.
I guess it's a nitpicking, but nonetheless. Should it be |
|
b6cf6c1
to
ac3df73
Compare
Further work to add support for the |
@tonycoz - Any additional thoughts? I see you reviewed the first round but that was before I added all the |
perly.y
Outdated
croak("Expected a lexical subroutine reference, found %" SVf_QUOTEDPREFIX, | ||
SVfARG(bareword)); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bison doesn't complain, but shouldn't there be a semi-colon here?
Looks good except for the possibly ignorable missing semi-colon.
|
The implementation of |
Oh I see, oops. I might have misunderstood that part. I'll adjust it to match PPC0033. |
Having now adjusted it to also invoke package methods (without the full MRO lookup), most of the grammar changes are no longer needed, so that lack of semicolon in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me
This came to light in discussions of Perl/PPCs#68 that
my method
doesn't actually parse as it should. This PR adds that.This also adds the corresponding
->&
as discussed in PPC0033.